import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/views/login/Login.vue'

Vue.use(Router)



// 解决重复点击导航路由报错
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err);
}

export default new Router({
    routes: [{
            path: '/',
            name: 'Home',
            component: () =>
                import ("@/views/Home"),
            children: [
                // {
                //     path: '/',
                //     redirect: '/home'
                // },
                {
                    path: '/',
                    name: 'home',
                    component: () =>
                        import ('@/views/home/index')
                },
                {
                    path: '/user',
                    name: 'user',
                    component: () =>
                        import ('@/views/user/index')
                },
                {
                    path: '/system',
                    name: 'system',
                    component: () =>
                        import ('@/views/system/index')
                },
                {
                    path: '/pageOne',
                    name: 'pageOne',
                    component: () =>
                        import ('@/views/order/orderPageOne')
                },
                {
                    path: '/pageTwo',
                    name: 'pageTwo',
                    component: () =>
                        import ('@/views/order/orderPageTwo')
                },
            ]
        },
        {
            path: '/login',
            name: 'Login',
            component: () =>
                import ('@/views/login/Login.vue')
        }
    ]
})